package com.xin.components.mc
{
import com.xin.components.TextButton;

import flash.display.MovieClip;

	/**
	 * 剪辑按钮
	 * @author xin
	 */
	public class McButton extends TextButton
	{
		private var _mc:MovieClip;
		
		public function McButton(mc:MovieClip, text:String = "", clickHandler : Function = null)
		{
			_mc = mc;
			super(mc.width, mc.height, text, clickHandler);
		}

		override protected function addChildren() : void
		{
			super.addChildren();
			
			addChildAt(_mc, 0);
			_mc.mouseEnabled = _mc.mouseChildren = false;
		}
		
		override protected function goUp() : void
		{
			_mc.gotoAndStop(1);
		}

		override protected function goOver() : void
		{
			_mc.gotoAndStop(2);
		}
		
		override protected function goDown() : void
		{
			_mc.gotoAndStop(3);
		}
		
		override public function draw() : void
		{
			super.draw();
			
			_mc.width = _width;
			_mc.height = _height;
		}

	}
}
